
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QProcess>
#include<QStringList>
#include<QString>
#include<windows.h>


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->B1,&QToolButton::clicked,this,[=](){switchoff();});

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::switchoff(){

    QString program = "C:/WINDOWS/system32/shutdown.exe";
    QStringList arguments;
    arguments << "-s";
    QProcess *myProcess = new QProcess();
    myProcess->start(program, arguments);

}



